package com.cky.software.shishuyao;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class map { public static void main(String[] args) {

    // base 1
    Map<String, Integer> map = new HashMap<>();
    for (int i = 1; i <= 6; i++) {
        // key , value
        map.put("第" + i + "个数据是", i);
    }
    System.out.println(map);

    System.out.println("------------------------------");

    // base 2
    List<Integer> list = new ArrayList<>();
    for (Map.Entry<String, Integer> keys : map.entrySet()) {
        String key = keys.getKey();
        int value = keys.getValue();
        list.add(value);
    }
    System.out.println("-----------------------------");

    // base 3 int a[] = {1, 2, 3, 4, 5, 6}
    // ------------------0, 1, 2, 3, 4, 5
    for (int i = 1; i <= list.size(); i++) {
        int j = list.get(i - 1);
        if (j % 2 == 0) {
            System.out.println("为偶数: " + j);
        } else {
            System.out.println("为奇数: " + j);
        }
    }

}
}
